#include "Parser.h"
#include "Feed.h"
#include <time.h>
#include <iostream>
int main()
{


string url="http://rss.slashdot.org/Slashdot/slashdot";
string command = "python reader.py";
Parser parser(command);
Feed feed;
unsigned int status;
status=parser.Parse(url,feed);

switch(status)

{
case Parser::feedok:
	
	{
	Feed::iterator it;

	cout<<"Feed: "<<feed.getName()<<endl<<"URL: "<<feed.getURL()<<endl;

	for(it=feed.begin();it!=feed.end();it++)
	{
		time_t t = it->getDate();
		struct tm * fecha=gmtime(&t);

		cout<<"Fecha: "<<asctime(fecha)<<endl;
		cout<<"Titulo: "<<(it->getTitle())<<endl;
		cout<<"Descripcion: "<<endl<<(it->getDescription())<<endl<<endl;
	
	}
	}
	break;


case Parser::feedupdated:
	cout<<"El Feed se encuentra Actualizado"<<endl;
	break;

case Parser::feedbad:
	cout<<"El Feed solicitado no existe"<<endl;
	break;
case Parser::nocommand:
	cout<<"El plugin no pudo ejecutarse: "<<command<<endl;
	break;
}

}
